package game.editer.view;


/**
	 package game.editer;

import hx.layout.AnchorLayoutData;
import game.editer.ui.Config;
import hx.display.Label;
import hx.display.VBox;
import hx.display.Button;
import hx.display.TextInput;
import hx.events.MouseEvent;
import hx.files.FileDialog;

class SaveAsProjectView extends BaseView {
    public function new() {
        super("工程另存为", 500, 300);
    }

    override function onInit() {
        super.onInit();

        var container = new VBox();
        container.gap = 20;
        this.body.addChild(container);
        container.layoutData = AnchorLayoutData.center();

        // 路径选择区域
        var pathGroup = new VBox();
        pathGroup.gap = 10;
        container.addChild(pathGroup);

        var pathLabel = new Label("保存路径:", Config.COMMON_TEXT_FORMAT);
        pathGroup.addChild(pathLabel);

        var pathInput = new TextInput();
        pathInput.width = 400;
        pathGroup.addChild(pathInput);

        var browseBtn = new Button("浏览...", Config.COMMON_TEXT_FORMAT);
        browseBtn.onClick = function(e:MouseEvent) {
            var dialog = new FileDialog();
            dialog.directory = true;
            if(dialog.showSave()) {
                pathInput.text = dialog.selectedFile.nativePath;
            }
        };
        pathGroup.addChild(browseBtn);

        // 文件名输入
        var nameGroup = new VBox();
        nameGroup.gap = 10;
        container.addChild(nameGroup);

        var nameLabel = new Label("工程名称:", Config.COMMON_TEXT_FORMAT);
        nameGroup.addChild(nameLabel);

        var nameInput = new TextInput();
        nameInput.width = 400;
        nameGroup.addChild(nameInput);

        // 按钮组
        var btnGroup = new HBox();
        btnGroup.gap = 30;
        container.addChild(btnGroup);

        // 保存按钮
        var saveBtn = new Button("保存", Config.COMMON_TEXT_FORMAT);
        saveBtn.onClick = function(e:MouseEvent) {
            if(pathInput.text == "" || nameInput.text == "") {
                MessageView.show("错误", "请填写完整路径和名称");
                return;
            }
            saveProject(pathInput.text, nameInput.text);
            this.close();
        };
        btnGroup.addChild(saveBtn);

        // 取消按钮
        var cancelBtn = new Button("取消", Config.COMMON_TEXT_FORMAT);
        cancelBtn.onClick = function(e:MouseEvent) {
            this.close();
        };
        btnGroup.addChild(cancelBtn);
    }

    private function saveProject(path:String, name:String):Void {
        trace('正在保存工程到: $path/$name');
        // 这里添加实际保存逻辑
        MessageView.show("提示", "工程另存为成功");
    }
}
* 动作列表
	 */
     


import js.Browser;
import js.html.AnchorElement;

class SaveAsProjectView {
    public function new() {
        // 创建虚拟链接元素
        var a = Browser.document.createAnchorElement();
        a.href = "data:application/octet-stream," + "项目导出内容"; // 这里替换为实际要导出的数据
        a.download = "RoleProject.abproj"; // 设置默认文件名
        a.style.display = "none";
        
        Browser.document.body.appendChild(a);
        a.click();
        Browser.document.body.removeChild(a);
    }
}
